using System.Diagnostics;
using Pronghorn.Core;

namespace Pronghorn.Core
{
	public abstract class FileLocatorBase : IFileLocator
	{
		protected string GetFilePath(string fileId, IFileConventions fileConventions)
		{
            // <pex>
            Debug.Assert(fileConventions != (IFileConventions)null, "fileConventions");
            // </pex>
			var extraPath = string.Empty;
			var fileName = fileId.Substring(fileId.LastIndexOf('.') + 1);
			if (fileId.IndexOf('.') > -1)
			{
				extraPath = fileId.Replace('.', '/').Substring(0, fileId.LastIndexOf('.')) + "/";
			}
			return fileConventions.GetBasePath() + "/" + extraPath + fileName;
		}
		public abstract string GetFileLocation(string fileId, IFileConventions fileConventions);
	}
}